public class LeetCode11 {
    public int maxArea(int[] height) {
        int i = 0, j = height.length - 1;
        int max = 0;
        while (i < j) {
            int min = Math.min(height[i], height[j]) * (j - i);
            max = Math.max(max, min );
            if (height[i] <= height[j]) {
                ++i;
            }else {
                --j;
            }
        }
        return max;
    }
}
